<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- hello comment -->
    <div>hello div</div>
    <p>hello p</p>
    <script>
      const boxDiv = document.body.children[0];
      const boxP = document.body.children[1];
      const text = document.body.childNodes[0];
      const comment = document.body.childNodes[1];

      console.log(boxDiv.nodeType);
      console.log(boxP.nodeType);
      console.log(text.nodeType);
      console.log(comment.nodeType); //8
      console.log(document.nodeType); //9
    </script>
  </body>
</html>
